<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>栏目管理</title>
		[#include "/html/include/easyuicss.html" /]
		[#include "/html/include/easyuijs.html" /]
	</head>
	<body>
		<form id="infoForm" class="easyui-form" method="post" data-options="novalidate:true">
			<input type="hidden" name="method" value="${RequestParameters['method']}" />
			<input type="hidden" name="categoryId" id="categoryId" value="${RequestParameters['categoryId']?default(info.category_id)}" />
			<table class="tblEidt">
				<tr>
					<td class="tdText" style="width:22%;">
						栏目名称<label style="color:red;">*</label>：
					</td>
					<td class="tdInput" style="width:78%;">
						<input class="easyui-textbox" name="categoryName" value="${info.category_name}" style="width:80%;" data-options="required:true" />
					</td>
				</tr>
				<tr>
					<td class="tdText">
						上级栏目<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						[@fl_select id="parentId" name="parentId" value="${(info.parent_id)?default('')}"
						otherAttr='style="width:80%;" class="easyui-combobox" data-options="editable:false,required:true" validType="Commbox[\'该选项为必选项\',\'#parentId\']" '
						list=Request['parents'] headLabel="根节点" headValue="-1" optionLabel="category_path" optionValue="category_id"]
						${tag_html}
						[/@fl_select]
					</td>
				</tr>
				<tr>
					<td class="tdText">
						栏目类型<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						[@fl_select id="categoryType" name="categoryType" value="${(info.category_type)?default('')}"
						otherAttr='style="width:80%;" class="easyui-combobox" data-options="editable:false,required:true" validType="Commbox[\'该选项为必选项\',\'#categoryType\']" '
						list=Request['types'] headLabel="请选择..." headValue="" optionLabel="item_name" optionValue="item_id"]
						${tag_html}
						[/@fl_select]
					</td>
				</tr>
				<tr>
					<td class="tdText">
						显示顺序<label style="color:red;">*</label>：
					</td>
					<td class="tdInput">
						<input class="easyui-textbox" name="showOrder" style="width:80%;" value="${info.show_order}" data-options="required:true" validType="Number" />
					</td>
				</tr>
			</table>
			<div class="edit-btn-group">
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-ok'" style="width:80px"
				   onclick="save(this);">保存</a>
				&nbsp;&nbsp;
				<a href="javascript:;" class="easyui-linkbutton"
				   data-options="iconCls:'icon-cancel'" style="width:80px"
				   onclick="closeWindow();">关闭</a>
			</div>
		</form>
	</body>
    <script type="text/javascript">
		var index = parent.layer.getFrameIndex(window.name);
		function closeWindow(){
			parent.layer.close(index);
		}
		function save(obj){
			$(obj).linkbutton('disable');
			$('#infoForm').form('submit', {
				url: '${app}/blog/category/save.do',
				onSubmit: function () {
					var valid = $(this).form('enableValidation').form('validate');
					if (!valid) {
						$(obj).linkbutton('enable');
					}
					return valid;
				},
				success: function (data) {
					var result = $.parseJSON(data);
					parent.easyui.msgShow('系统提醒', result.msg, 3000, 250, 100);
					$(obj).linkbutton('enable');
					if (result.result == 1) {
						parent.layer.close(index);
						parent.frames[parent.iframeName].window.showList();
					}
				}
			});
		}
    </script>
</html>